package com.yf;

import com.group.www.Application;
import com.group.www.pojo.GoodsInfo;
import com.group.www.service.impl.SimpleIGoodsinfo_qService;
import com.group.www.util.PrintResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.awt.print.PrinterGraphics;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes= Application.class)
public class test {

    @Autowired
    private SimpleIGoodsinfo_qService simpleIGoodsinfo_q;

    @Test
    public void test01(){
        List<GoodsInfo> list = simpleIGoodsinfo_q.queryGoodsInfoBycategoryid(1);
        PrintResult.printListToString(list);
    }

    @Test
    public void test02(){
        List l = this.simpleIGoodsinfo_q.query();
        PrintResult.printListToString(l);
    }

    @Test
    public void test03(){
        List<GoodsInfo> list = this.simpleIGoodsinfo_q.queryGoodsInfoBygoodsid(9);
        PrintResult.printListToString(list);
    }

    @Test
    public void test04(){
        List<GoodsInfo> list = this.simpleIGoodsinfo_q.queryGoodsInfoBygoodsid(9);
        GoodsInfo goodsInfo = list.get(0);
        goodsInfo.setGoodsid(null);
        goodsInfo.setGoodsremark("update after");
        this.simpleIGoodsinfo_q.add(goodsInfo);
    }

    @Test
    public void test05(){
        List<GoodsInfo> list = this.simpleIGoodsinfo_q.queryGoodsInfoBygoodsid(9);
        GoodsInfo goodsInfo = list.get(0);
        goodsInfo.setGoodsid(18);
        goodsInfo.setGoodsremark("update after++++++");
        this.simpleIGoodsinfo_q.update(goodsInfo);
    }

    @Test
    public void test06(){
        List li = this.simpleIGoodsinfo_q.query();
        PrintResult.printListToString(li);
    }

    @Test
    public void test07(){
        List<GoodsInfo> list = this.simpleIGoodsinfo_q.queryGoodsInfoBygoodsid(10);
        this.simpleIGoodsinfo_q.delete(list.get(0));
    }


}
